import React, { Component } from 'react'
import { Switch, Redirect, withRouter } from 'react-router'
import { PrivateRoute } from 'components/route'
import FetchState from './fetchState'
import FetchItem from './fetchItem'

class PeojectView extends Component {
  componentDidMount() {}

  render() {
    const { match, location, pid } = this.props
    console.log(match, location)
    return (
      <Switch location={location}>
        <PrivateRoute path={`${match.url}/`} render={props => <FetchState {...props} />} exact />
        <PrivateRoute
          path={`${match.url}/:labelState`}
          render={props => <FetchItem {...props} pid={pid} />}
          exact={false}
        />
      </Switch>
    )
  }
}

export default withRouter(PeojectView)
